/**
 * 
 */
package com.cp16.tss.bo;

import java.util.List;

import com.cp16.tss.dao.CustomerDAO;
import com.cp16.tss.dto.Customer;

/**
 * @author ADMIN
 * 
 */
public class CustomerBO {

	private CustomerDAO customerDAO = new CustomerDAO();

	public Customer getCustomerById(int customerId) throws Exception {
		return customerDAO.getCustomerById(customerId);
	}

	public List<Customer> getCustomerByName(String customerName) throws Exception {
		return customerDAO.getCustomerByName(customerName);
	}

	public List<Customer> getAllCustomer(){
		return customerDAO.getAllCustomer();
	}
	
	public boolean addCustomer(Customer customer) throws Exception {
		if (customerDAO.addCustomer(customer)) {
			return true;
		} else {
			return false;
		}
	}

	public boolean updateCustomer(Customer customer) throws Exception {
		if (customerDAO.updateCustomer(customer)) {
			return true;
		} else {
			return false;
		}
	}

	public boolean deleteCustomer(Customer customer) throws Exception {
		if (customerDAO.deleteCustomer(customer)) {
			return true;
		} else {
			return false;
		}
	}

	public boolean checkCustomerExist(int  customerId) throws Exception {
		if (customerDAO.checkCustomerExist(customerId)) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * @return the customerDAO
	 */
	public CustomerDAO getCustomerDAO() {
		return customerDAO;
	}

	/**
	 * @param customerDAO
	 *            the customerDAO to set
	 */
	public void setCustomerDAO(CustomerDAO customerDAO) {
		this.customerDAO = customerDAO;
	}

}
